﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using bzxxxt.dal;

namespace bzxxxt.model
{
    public class DeadModel
    {
        public int id { get; set; }
        public string name { get; set; }
        public string code { get; set; }
        public string cardno { get; set; }
        public string gender { get; set; }
        public DateTime? birthday { get; set; }
        public DateTime? deathtime { get; set; }
        public string nationId { get; set; }
        public string nationName { get; set; }
        public string areacode { get; set; }
        public string areaName { get; set; }
        public string deathplace { get; set; }
        public string deathcause { get; set; }
        public string education { get; set; }
        public string profession { get; set; }
        public string birAddress { get; set; }
        public string homeAddress { get; set; }
        public string photo { get; set; }

        public string relationId { get; set; }
        public int? relativeId { get; set; }
        public string relativeName { get; set; }
        public string relativeCardno { get; set; }
        public string relativeGender { get; set; }
        public string relativeTel { get; set; }
        public string relativeCompany { get; set; }
        public string relativeTitle { get; set; }
        public string relativeAddr { get; set; }
        public string relativeAreaId { get; set; }
        public string relativeAreaName { get; set; }
       
        public string estArriveplace { get; set; }
        public DateTime? estArrivetime { get; set; }
        public DateTime? actFiretime { get; set; }
        public string estStoreplace { get; set; }
        public DateTime? estStoretime { get; set; }
        public string description { get; set; }


        public int? graveId { get; set; }
        public string graveName { get; set; }
        public string graveLocation { get; set; }
        public int graveType { get; set; }

        public int? paradiseId { get; set; }
        public string paradiseName { get; set; }

        public DateTime? storeTime { get; set; }
        public string storeType { get; set; }

        public int? days { 
            get{
                int? d = null;
                if (storeTime != null && graveId != null)
                {
                    //已寄存
                    if (actFiretime != null)
                    {
                        d = new TimeSpan(storeTime.Value.Ticks - actFiretime.Value.Ticks).Days;
                    }
                }
                else
                {
                    if (actFiretime != null)
                    {
                        d = new TimeSpan(DateTime.Now.Ticks - actFiretime.Value.Ticks).Days;
                    }
                }
                return d;
            }
        }
    }
}